<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">

    <ui:composition template="layout.xhtml">
        <ui:define name="body">
            <h:form id="form" enctype="multipart/form-data">
                <br/>
                <h3 class="title">Revisão de Alinhamento</h3>
                <p:growl id="messages" showDetail="false" autoUpdate="true"  /> 
                <hr/>
                <br/>
                <p:panel id="panel" styleClass="container_24 clearfix withoutBorder">
                    <h5 class="title">Dados do Proprietário</h5>

                    <p:dataTable id="tableProprietario" var="item" value="#{managerCriarRevisaoAlinhamento.imovel.proprietarios}" 
                                 styleClass="grid_24" emptyMessage="Nenhum registro">  
                        <f:facet name="header">
                            Nome do Proprietário ou Detentor
                        </f:facet>

                        <p:column headerText="Nome">  
                            #{item.tipoDocumento ne null ? 
                              (item.tipoDocumento eq 'CPF' ? item.nome : item.nomeFantasia) : 
                              (item.nome ne null and item.nome ne '' ? item.nome : item.nomeFantasia)}
                        </p:column>

                        <p:column headerText="Documento" >  
                            #{item.formatedDocument()}
                        </p:column> 

                    </p:dataTable>      
                </p:panel>
                <div class="clear"/>

                <p:panel id="panelLocalizacao" styleClass="container_24 clearfix withoutBorder">
                    <h5 class="title">Dados de Localização</h5>

                    <p:outputLabel value="Logradouro" styleClass="grid_3 logradouroLabelImovel" for="patioInputText" />
                    <p:inputText id="patioInputText" styleClass="grid_18" 
                                 readonly="true"
                                 value="#{managerCriarRevisaoAlinhamento.imovel.enderecoImovel.nomeclog}" />
                    <div class="clear"/>

                    <p:outputLabel value="Bairro" styleClass="grid_3" for="neighborhoodInputText" />
                    <p:inputText id="neighborhoodInputText" styleClass="grid_18"
                                 readonly="true"
                                 value="#{managerCriarRevisaoAlinhamento.imovel.enderecoImovel.bairro}" />

                    <p:outputLabel value="Número" styleClass="grid_3" for="numInputText" />
                    <p:inputText id="numInputText" styleClass="grid_4"
                                 readonly="true"
                                 value="#{managerCriarRevisaoAlinhamento.imovel.enderecoImovel.numero}" />

                    <p:outputLabel value="Complemento" styleClass="grid_5 alpha" for="compInputText" />
                    <p:inputText id="compInputText" styleClass="grid_9"
                                 readonly="true"
                                 value="#{managerCriarRevisaoAlinhamento.imovel.enderecoImovel.compl}" />
                </p:panel>

                <p:panel id="panelDimensao" styleClass="container_24 clearfix withoutBorder">
                    <h5 class="title">Dimensões e Confrontações</h5>
                    <fieldset><legend>Frente</legend>
                        <p:panel styleClass="container_24 clearfix withoutBorder">
                            <p:outputLabel value="Para" styleClass="grid_3" for="frenteInputText" />
                            <p:inputText id="frenteInputText" styleClass="grid_18"
                                         value="#{managerCriarRevisaoAlinhamento.imovel.frente}" 
                                         readonly="true"/>

                            <div class="clear"/>
                            <p:outputLabel value="Limitando" styleClass="grid_3 dimensaoLabelImovel" for="frenteRuaInputText" />
                            <p:inputText id="frenteRuaInputText" styleClass="grid_18"
                                         value="#{managerCriarRevisaoAlinhamento.imovel.frenteRua}"
                                         readonly="true"/>
                            <div class="clear"/>
                            <p:outputLabel value="Medindo" styleClass="grid_3 dimensaoLabelImovel" for="frenteMedInputText" />
                            <p:inputText id="frenteMedInputText" styleClass="grid_18"
                                         value="#{managerCriarRevisaoAlinhamento.imovel.frenteMedindo}"
                                         readonly="true"/>
                        </p:panel>
                    </fieldset>
                    <div class="clear"/>

                    <fieldset><legend>Lado Direito</legend>
                        <p:panel styleClass="container_24 clearfix withoutBorder">
                            <p:outputLabel value="Para" styleClass="grid_3" for="direitoParaInputText" />
                            <p:inputText id="direitoParaInputText" styleClass="grid_18" 
                                         value="#{managerCriarRevisaoAlinhamento.imovel.ladoDireito}" 
                                         readonly="true"/>
                            <div class="clear"/>

                            <p:outputLabel value="Limitando" styleClass="grid_3 dimensaoLabelImovel" for="direitoRuaInputText" />
                            <p:inputText id="direitoRuaInputText" styleClass="grid_18" 
                                         value="#{managerCriarRevisaoAlinhamento.imovel.ladoDireitoRua}"
                                         readonly="true"/>
                            <div class="clear"/>

                            <p:outputLabel value="Medindo" styleClass="grid_3 dimensaoLabelImovel" for="direitoMedInputText" />
                            <p:inputText id="direitoMedInputText" styleClass="grid_18" 
                                         value="#{managerCriarRevisaoAlinhamento.imovel.ladoDireitoMedindo}"
                                         readonly="true"/>
                        </p:panel>
                        <div class="clear"/>
                    </fieldset>

                    <fieldset><legend>Lado Esquerdo</legend>
                        <p:panel styleClass="container_24 clearfix withoutBorder">
                            <p:outputLabel value="Para" styleClass="grid_3" for="esquerdoInputText" />
                            <p:inputText id="esquerdoInputText" styleClass="grid_18" 
                                         value="#{managerCriarRevisaoAlinhamento.imovel.ladoEsquerdo}"
                                         readonly="true"/>
                            <div class="clear"/>

                            <p:outputLabel value="Limitando" styleClass="grid_3 dimensaoLabelImovel" for="esquerdoRuaInputText" />
                            <p:inputText id="esquerdoRuaInputText" styleClass="grid_18" 
                                         value="#{managerCriarRevisaoAlinhamento.imovel.ladoEsquerdoRua}"
                                         readonly="true"/>
                            <div class="clear"/>

                            <p:outputLabel value="Medindo" styleClass="grid_3 dimensaoLabelImovel" for="esquerdoMedInputText" />
                            <p:inputText id="esquerdoMedInputText" styleClass="grid_18" 
                                         value="#{managerCriarRevisaoAlinhamento.imovel.ladoEsquerdoMedindo}"
                                         readonly="true"/>
                        </p:panel>
                        <div class="clear"/>
                    </fieldset>

                    <fieldset><legend>Fundo</legend>
                        <p:panel styleClass="container_24 clearfix withoutBorder">
                            <p:outputLabel value="Para" styleClass="grid_3" for="fundoInputText" />
                            <p:inputText id="fundoInputText" styleClass="grid_18" 
                                         value="#{managerCriarRevisaoAlinhamento.imovel.fundo}"
                                         readonly="true"/>
                            <div class="clear"/>
                            <p:outputLabel value="Limitando" styleClass="grid_3 dimensaoLabelImovel" for="fundoRuaInputText" />
                            <p:inputText id="fundoRuaInputText" styleClass="grid_18" 
                                         value="#{managerCriarRevisaoAlinhamento.imovel.fundoRua}"
                                         readonly="true"/>
                            <div class="clear"/>
                            <p:outputLabel value="Medindo" styleClass="grid_3 dimensaoLabelImovel" for="fundoMedInputText" />
                            <p:inputText id="fundoMedInputText" styleClass="grid_18" 
                                         value="#{managerCriarRevisaoAlinhamento.imovel.fundoMedindo}"
                                         readonly="true"/>
                        </p:panel>
                    </fieldset>
                </p:panel>


                <p:panel id="panelProcesso" styleClass="container_24 clearfix withoutBorder">
                    <h5 class="title">Processo</h5>

                    <p:outputLabel value="Número " styleClass="grid_3"  />
                    <p:inputText id="processoInputText" styleClass="grid_18" 
                                 value="#{managerCriarRevisaoAlinhamento.revisaoAlinhamento.numeroProcesso}" 
                                 />
                    <div class="clear"/>
                </p:panel>

                <p:panel id="panelLivro" styleClass="container_24 clearfix withoutBorder">
                    <h5 class="title">Dados Livro</h5>

                    <p:outputLabel value="Livro " styleClass="grid_3" for="livroInputText"  />
                    <p:inputText id="livroInputText" styleClass="grid_7" 
                                 value="#{managerCriarRevisaoAlinhamento.revisaoAlinhamento.livro}" 
                                 required="true" 
                                 />
                    <p:outputLabel value="Folha " styleClass="grid_4" for="folhaInputText"  />
                    <p:inputText id="folhaInputText" styleClass="grid_7" 
                                 value="#{managerCriarRevisaoAlinhamento.revisaoAlinhamento.folha}" 
                                 required="true" 

                                 />
                    <div class="clear"/>
                    <p:outputLabel value="Matrícula " styleClass="grid_3" for="matriculaInputText"  />
                    <p:inputText id="matriculaInputText" styleClass="grid_7" 
                                 value="#{managerCriarRevisaoAlinhamento.revisaoAlinhamento.matricula}" 
                                 required="true" 

                                 />
                    <div class="clear"/>
                </p:panel>

                <p:panel id="panelDimensaoTerreno" styleClass="container_24 clearfix withoutBorder">
                    <h5 class="title">Dimensões do Terreno</h5>

                    <p:outputLabel value="Frente " styleClass="grid_3" for="fInputText" />
                    <p:inputText id="fInputText" styleClass="grid_7" 
                                 value="#{managerCriarRevisaoAlinhamento.revisaoAlinhamento.frente}"
                                 onkeypress="jQuery(this).autoNumeric({aSep: '.', aDec: ','} );"
                                 required="true" 
                                 >
                        <f:convertNumber pattern="#,###,##0.00" locale="pt,BR"/>

                    </p:inputText>

                    <p:outputLabel value="Fundo " styleClass="grid_4" for="fuInputText" />
                    <p:inputText id="fuInputText" styleClass="grid_7" 
                                 value="#{managerCriarRevisaoAlinhamento.revisaoAlinhamento.fundo}"
                                 onkeypress="jQuery(this).autoNumeric({aSep: '.', aDec: ','} );"
                                 required="true" 
                                 >
                        <f:convertNumber pattern="#,###,##0.00" locale="pt,BR"/>
                    </p:inputText>
                    <div class="clear"/>
                    <p:outputLabel value="Lado Direito " styleClass="grid_3" for="diInputText" />
                    <p:inputText id="diInputText" styleClass="grid_7" 
                                 value="#{managerCriarRevisaoAlinhamento.revisaoAlinhamento.ladoDireito}"
                                 onkeypress="jQuery(this).autoNumeric({aSep: '.', aDec: ','} );"
                                 required="true" 
                                 >
                        <f:convertNumber pattern="#,###,##0.00" locale="pt,BR"/>
                    </p:inputText>

                    <p:outputLabel value="Lado Esquerdo" styleClass="grid_4" for="eInputText" />
                    <p:inputText id="eInputText" styleClass="grid_7" 
                                 value="#{managerCriarRevisaoAlinhamento.revisaoAlinhamento.ladoEsquerdo}"
                                 onkeypress="jQuery(this).autoNumeric({aSep: '.', aDec: ','} );"
                                 required="true" 
                                 >
                        <f:convertNumber pattern="#,###,##0.00" locale="pt,BR"/>
                    </p:inputText>
                    <div class="clear"/>
                    <p:outputLabel value="Área Total " styleClass="grid_3" for="arInputText" />
                    <p:inputText id="arInputText" styleClass="grid_7" 
                                 value="#{managerCriarRevisaoAlinhamento.revisaoAlinhamento.areaTotal}"
                                 onkeypress="jQuery(this).autoNumeric({aSep: '.', aDec: ','} );"
                                 required="true" 
                                 >
                        <f:convertNumber pattern="#,###,##0.00" locale="pt,BR"/>
                    </p:inputText>

                </p:panel>

                <p:panel id="panelInvasao" styleClass="container_24 clearfix withoutBorder">
                    <h5 class="title">Levantamento</h5>

                    <p:outputLabel value="Há Invasão " styleClass="grid_3" />
                    <p:selectBooleanCheckbox styleClass="grid_3" value="#{managerCriarRevisaoAlinhamento.revisaoAlinhamento.invasao}"/>
                    <div class="clear"/>
                    <p:outputLabel value="Descrição " styleClass="grid_3" />
                    <p:inputTextarea value="#{managerCriarRevisaoAlinhamento.revisaoAlinhamento.descricaoPavimentacao}"
                                     styleClass="grid_10"/>
                </p:panel>

                <div class="buttonAction">
                    <p:commandButton id="bt_salvar" value="Salvar" icon="ui-icon-disk"
                                     update="@form"
                                     actionListener="#{managerCriarRevisaoAlinhamento.salvar()}"
                                     styleClass="ui-priority-primary" />
                    <p:commandButton action="#{managerCriarRevisaoAlinhamento.redirectRevisaoAlinhamento()}" value="Cancelar" process="@this"  icon="ui-icon-trash" />
                </div >

                <p:dialog id="dlgPrint" width="450" modal="true" widgetVar="printDialog" header="Imprimir" closable="false" >
                    <p:outputLabel value="Deseja imprimir a revisão de alinhamento ?" />
                    <div class="clear"/>

                    <div class="buttonAction" style="padding-top: 25px">
                        <p:commandButton title="Imprimir"
                                         styleClass="printButton"
                                         value="Sim"
                                         ajax="false" update="@form"
                                         onclick="this.form.target='_blank'"
                                         actionListener="#{managerCriarRevisaoAlinhamento.relatorioRevisaoAlinhamento()}"
                                         icon="ui-icon-print" />
                        <p:commandButton value="Não" icon="ui-icon-close" actionListener="#{managerCriarRevisaoAlinhamento.redirectRevisaoAlinhamento()}" />
                    </div>
                    <script>
                        $('.printButton').mouseup(function(){     
                            window.open("pesquisarimovel.xhtml", "_SELF");
                        });
                    </script>
                </p:dialog>
            </h:form>
        </ui:define>
    </ui:composition>

</html>
